<?php
/**
 * Created by PhpStorm.
 * User: mawenhuan
 * Date: 2019-06-28
 * Time: 16:43
 */

namespace App\Utils;


class OssSignUtil
{

    const DEFAULT_IMG = 'images/2019/06/28/1561713330.png';

    public static function signOne($str)
    {
        return OssUtil::fetchGetSignUrl($str);
    }
    public static function signString($imgs, $delimer=',')
    {
        $imgArrs = explode($delimer, $imgs);
        $res = [];
        foreach ($imgArrs as $img){
            $res[] = OssUtil::fetchGetSignUrl($img);
        }
        return $res;
    }

    public static function defaultImg()
    {
        return OssUtil::fetchGetSignUrl(self::DEFAULT_IMG);
    }

    public static function resizeConf()
    {
        $w = $_SERVER['HTTP_SCREEN_WIDTH'] ?? 600;
        return 'resize,m_fixed,w_' . $w;
    }
}